



//
//  CSTransferDetailCell.m
//  JiFengDaRen
//
//  Created by SH_iOS on 2017/9/19.
//  Copyright © 2017年 SH_iOS. All rights reserved.
//
#import "SHButton.h"
#import "CSTransferDetailCell.h"

@implementation CSTransferDetailCell{
    SHButton *copyBtn;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self configUI];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
    
}

- (void)configUI{
    self.nameLabel = [[UILabel alloc]init];
    self.nameLabel.font = KSHSystemFont(15);
    [self.contentView addSubview:self.nameLabel];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(__I6Width(15));
        make.centerY.equalTo(self.mas_centerY).with.offset(0);
        make.height.mas_equalTo(__I6Height(20));
    }];
    
    self.contentLabel = [[UILabel alloc]init];
    self.contentLabel.font = KSHSystemFont(15);
    
    self.contentLabel.textAlignment  = NSTextAlignmentLeft;
    self.contentLabel.textColor =  KGARACOLOR;
    [self.contentView addSubview:self.contentLabel];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.nameLabel.mas_centerY).with.offset(0);
        make.right.equalTo(self.mas_right).with.offset(__I6Width(-40));
        make.left.equalTo(self.nameLabel.mas_right).with.offset(0);

    }];
    
    UIView *line  = [[UIView alloc]init];
    line.backgroundColor  = KLINECOLOR;
    [self addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(__I6Width(15));
        make.bottom.equalTo(self.mas_bottom);
        make.width.mas_equalTo(KScreenWidth);
        make.height.mas_equalTo(0.5);
    }];
    
    copyBtn = [SHButton buttonWithType:UIButtonTypeCustom title:@"复制" font:15 titleColor:KREDCOLOR textAlignment:0 forState:UIControlStateNormal];
    copyBtn.layer.borderWidth = 0.5;
    copyBtn.layer.borderColor = KREDCOLOR.CGColor;
    copyBtn.layer.cornerRadius = __I6Height(15);
    copyBtn.layer.masksToBounds = YES;
    [copyBtn addTarget:self action:@selector(copyBtnCliked:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:copyBtn];
    [copyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY).with.offset(0);
        make.right.equalTo(self.mas_right).with.offset(__I6Width(-15));
        make.height.mas_equalTo(__I6Height(30));
        make.width.mas_equalTo(__I6Width(50));
    }];
    
    
    
    
    
    
}

- (void)setLabelText:(NSString *)labelText{

    CGFloat labelW  = [SHHelper widthOfString:@"卡号后5位" font:    KSystemFont(15) height:__I6Height(20)] + __I6Width(15);
    [self.nameLabel mas_updateConstraints:^(MASConstraintMaker *make){
        make.left.equalTo(self.mas_left).with.offset(__I6Width(15));
        make.top.equalTo(self.mas_top).with.offset(__I6Height(11));
        make.width.mas_equalTo(labelW);
        make.height.mas_equalTo(__I6Height(20));
        
    }];
    self.nameLabel.text = labelText;
    
    
    
}


- (void)contentLabelText:(NSString *)text{
    self.contentLabel.text  = text;
    self.contentLabel.textColor = [UIColor blackColor];
}

- (void)copyBtnCliked:(SHButton *)sender{
    
    
//    BOOL b = [WXApiRequestHandler pasteboardLinkURL:_contentLabel.text];
//    
//    if (b) {
//        [[SHHelper currentViewController].view makeToast:@"已复制到剪切板" duration:1 position:@"center"];
//    }

}

- (void)setHiddenCopyBtn:(BOOL)hiddenCopyBtn{
    
    copyBtn.hidden = YES;
}

@end
